package com.hzg.springcloud.fegin;

import com.hzg.springcloud.domain.Product;
import com.hzg.springcloud.fegin.hystrix.ProductFeignHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @ Description: TODO
 * @ Author: 卓哥
 * @ Date: 2020/8/28 18:43
 * @ Version: 1.0
 */
//出现问题之后执行fallback =ProductFeignHystrix.class类里面的降级方法
@FeignClient(name = "PRODUCT-SERVER", fallback =ProductFeignHystrix.class)
//name表示调用注册中心的服务名
public interface IProductFeignApi {
    //访问指定服务的具体接口
//此处表示:访问product-server服务的/products/get/{id}接口
    @GetMapping("/products/get/{id}")
    Product get(@PathVariable("id") Long id);
}
